/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       blur.h
 * Author:     twoja stara
 * Created on: 2010-05-30
 *
 **********************************************************************************************************************/

#include "blur.h"

namespace mGameEngine
{
namespace Graphics
{

Blur::Blur(float size, const Texture *input, RenderTarget *output) :
    PostProcess(input, output),
    _xblur(0.0f, 0.0f, NULL, &_rtt),
    _yblur(M_PI_2, 0.0f, &_rtt, NULL),
    _rtt()
{
    setSize(size);
}

Blur::~Blur(void)
{
}

void Blur::process() const
{
    // no input/output
    if(!_input || !_output)
    {
        return;
    }

    // blur is disabled
    if(!_enabled)
    {
        return PostProcess::_passUnprocessed();
    }

    // process
    _rtt.setSize(_output->getSize());
    _xblur.process();
    _yblur.process();
}

}
}
